<clr-datagrid (clrDgRefresh)="refresh($event)" [(clrDgSelected)]="selected" class="wayne-clr-datagrid">
  <clr-dg-placeholder>暂无数据！</clr-dg-placeholder>
  <clr-dg-column class="col-id" [clrDgSortBy]="'id'">
    <ng-container>
      #
    </ng-container>
  </clr-dg-column>
  <clr-dg-column class="col-time" [clrDgSortBy]="'createTime'">
    <ng-container *clrDgHideableColumn="showState['create_time']">
      创建时间
    </ng-container>
  </clr-dg-column>
  <clr-dg-column class="col-port">
    <ng-container *clrDgHideableColumn="showState['端口号']">
      端口号
    </ng-container>
  </clr-dg-column>
  <clr-dg-column class="col-cluster">
    <ng-container *clrDgHideableColumn="showState['上线机房']">
      上线机房
    </ng-container>
  </clr-dg-column>
  <clr-dg-column class="col-description">
    <ng-container *clrDgHideableColumn="showState['发布说明']">
      发布说明
    </ng-container>
  </clr-dg-column>
  <clr-dg-column>
    <ng-container *clrDgHideableColumn="showState['创建者']">
      创建者
    </ng-container>
  </clr-dg-column>
  <clr-dg-column class="col-operate">
    <ng-container *clrDgHideableColumn="showState['操作']">
      操作
    </ng-container>
  </clr-dg-column>
  <clr-dg-row *ngFor="let serviceTpl of serviceTpls" [clrDgItem]="serviceTpl">
    <clr-dg-cell class="col-id">{{serviceTpl.id}}</clr-dg-cell>
    <clr-dg-cell class="col-time">{{serviceTpl.createTime | date:'yyyy-MM-dd HH:mm:ss'}}</clr-dg-cell>
    <clr-dg-cell class="col-port">{{serviceTpl.ports}}</clr-dg-cell>
    <clr-dg-cell class="col-cluster">
      <div class="form-group" style="padding-bottom: 2px"
           *ngFor="let status of serviceTpl.status">
        <a href="javascript:void(0)" (click)="serviceState(status,serviceTpl)" title="查看负载均衡状态" class="label"
           [class.clickable]="status.state!=2"
           [class.label-success]="status.state==0"
           [class.label-warning]="status.state==1">
          {{status.cluster}}
        </a>
      </div>
    </clr-dg-cell>
    <clr-dg-cell class="col-description">
      <div class="text-overflow">
        <a href="javascript:void(0)" (click)="tplDetail(serviceTpl)">{{serviceTpl.description}}</a>
      </div>
    </clr-dg-cell>
    <clr-dg-cell>{{serviceTpl.user}}</clr-dg-cell>
    <clr-dg-cell class="col-operate">
      <button class="wayne-button text"
              (click)="publishServiceTpl(serviceTpl)"
              *ngIf="authService.currentAppPermission.kubeService.create || authService.currentUser.admin">
        发布
      </button>
      <button class="wayne-button text"
              (click)="detailServiceTpl(serviceTpl)"
              *ngIf="authService.currentAppPermission.service.read || authService.currentUser.admin">
        详情
      </button>
      <button class="wayne-button text"
              (click)="cloneServiceTpl(serviceTpl)"
              *ngIf="authService.currentAppPermission.service.create || authService.currentUser.admin">
        克隆
      </button>
      <button class="wayne-button text"
              *ngIf="!serviceTpl.status && (authService.currentAppPermission.service.delete || authService.currentUser.admin)"
              (click)="deleteServiceTpl(serviceTpl)">
        删除
      </button>
      <button class="wayne-button text"
              (click)="offlineServiceTpl(serviceTpl)"
              *ngIf="serviceTpl.status && (authService.currentAppPermission.kubeService.delete || authService.currentUser.admin)">
        下线
      </button>

    </clr-dg-cell>
  </clr-dg-row>
  <clr-dg-footer>
    <wayne-paginate
      [(currentPage)]="currentPage"
      [total]="page.totalCount"
      [pageSizes]="[10, 20, 50]"
      (sizeChange)="pageSizeChange($event)"
    >
    </wayne-paginate>
  </clr-dg-footer>
</clr-datagrid>
<wayne-ace-editor></wayne-ace-editor>
<status></status>
<publish-tpl [appId]="appId" (published)="published($event)"></publish-tpl>
